<template>
  <el-radio-group v-model="tool">
    <el-radio-button label="Hand">抓手</el-radio-button>
    <el-radio-button label="Line">线段</el-radio-button>
    <el-radio-button label="Circle">圆</el-radio-button>
    <el-radio-button label="Rectangle">矩形</el-radio-button>
  </el-radio-group>
</template>

<script>
import Hand from "../tools/Hand";
import Line from "../tools/Line";
import Circle from "../tools/Circle";
import Rectangle from "../tools/Rectangle";

export default {
  data: () => ({
    tool: null,
  }),
  watch: {
    tool(new_val) {
      switch (new_val) {
        case "Hand":
          this.$store.dispatch('tools/changeTools', Hand);
          break;
      
        case "Line":
          this.$store.dispatch('tools/changeTools', Line);
          break;
      
        case "Circle":
          this.$store.dispatch('tools/changeTools', Circle);
          break;
      
        case "Rectangle":
          this.$store.dispatch('tools/changeTools', Rectangle);
          break;
      
        default:
          break;
      }
    },
  },
};
</script>

<style>
</style>